<template>
  <div class="content" v-loading="ishow">
    <el-card>
      <el-row>
        <el-form label-width="70px" size="small">
          <el-form-item label="关键字">
            <el-input v-model="params.keyWord" placeholder="请输入申请人" style="width: 300px;" clearable
              size="small"></el-input>
            <el-button type="primary" style="margin: 0 10px;" @click="getList" size="small">查询</el-button>
          </el-form-item>
        </el-form>

      </el-row>

      <el-row style="margin-top: 10px;">
        <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" border>
          <el-table-column prop="applicantName" label="申请人" align="center">
          </el-table-column>

          <el-table-column prop="applicantPrice" label="申请金额" align="center">
          </el-table-column>
          <!-- <el-table-column prop="reviewerName" label="审批人" align="center">
          </el-table-column> -->
          <el-table-column prop="applicantType" label="申请类型" align="center">
            <template #default="{row,$index}">
              {{row.applicantType==0?'支出':'收入'}}
            </template>
          </el-table-column>

          <el-table-column prop="applicantTime" label="申请时间" width="200" align="center">
            <template slot-scope="scope">{{ scope.row.applicantTime | formatCreateTimes }}</template>
          </el-table-column>
          <el-table-column prop="notes" label="说明" align="center">
          </el-table-column>

        </el-table>
      </el-row>

      <!-- v-if="total>5" -->
      <el-row>
        <div style="float: right;margin-top: 10px;">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page="params.pageNum" :page-sizes="[1, 5, 10]" :page-size="params.pageSize"
            layout="total, sizes, prev, pager, next, jumper" :total="total">
          </el-pagination>
        </div>
      </el-row>
    </el-card>


  </div>
</template>

<script>
  import {
    formatDate
  } from '../../../utils/date.js'
  export default {
    name: 'class',
    data() {
      return {
        params: {
          pageNum: 1,
          pageSize: 5,
          keyWord: ""
        },
        tableData: [],
        isAddOrUpdate: 0,//0添加1修改
        isAddorUpdateShow: false,
        form: {
          claPrice: 0
        },
        teacherList: [],
        total: 0,
        ishow: true
      };
    },
    filters: {
      formatCreateTimes(time) {
        let date = new Date(time);
        return formatDate(date, 'yyyy-MM-dd  hh:mm:ss')
      }
    },
    mounted() {
      this.getList()
    },

    methods: {
      getList() {
        console.log(this.$route
        );
        this.params.id = this.$route.query.id
        this.$api.cla.getDetaliList(this.params).then(res => {
          console.log(res);
          if (res.code == 200) {
            this.tableData = res.data
            this.total = res.pageParams.total
            this.ishow = false
          }
        })
      },
      handleSizeChange(val) {
        console.log(val);
        this.params.pageSize = val
        this.getList()
      },
      handleCurrentChange(val) {
        this.params.pageNum = val
        this.getList()
      },

    },
  };
</script>

<style lang="scss" scoped>
  .content {
    padding: 10px;
  }
</style>